home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / LGP250S1.ZIP / src / libgplus.5 / libgplus / gplus-in / math.h < prev    next >
C/C++ Source or Header  |  1993-04-17  |  5KB  |  222 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19.  
  20. #ifndef _math_h
  21. #ifdef __GNUG__
  22. #pragma interface
  23. #endif
  24. #define _math_h 1
  25.  
  26. #if defined(hp300) && defined(__HAVE_FPU__)
  27. #define __HAVE_68881__ 1
  28. #endif
  29.  
  30. #if defined(masscomp)
  31. #define __HAVE_68881__ 1
  32. #endif
  33.  
  34. #ifdef __HAVE_68881__        /* MC68881/2 Floating-Point Coprocessor */
  35. extern "C" {            /* fill in what we've left out */
  36. #include <math-68881.h>
  37.  
  38. double  acosh(double);
  39. double  asinh(double);
  40. double  cbrt(double);
  41. double  copysign(double,double);
  42. double  erf(double);
  43. double  erfc(double);
  44. double  finite(double);
  45. double  gamma(double);
  46. double  hypot(double,double);
  47. double  infnan(int);
  48. int     isinf(double);
  49. int     isnan(double);
  50. double  j0(double);
  51. double  j1(double);
  52. double  jn(int, double);
  53. double  lgamma(double);
  54. double  y0(double);
  55. double  y1(double);
  56. double  yn(int, double);
  57.  
  58. double aint(double);
  59. double anint(double);
  60. int irint(double);
  61. int nint(double);
  62. }
  63. /* Please add inline asm code for other machines here! */
  64. #else
  65. extern "C" {
  66.  
  67. #include <_G_config.h>
  68.  
  69. double  acos(double);
  70. double  acosh(double);
  71. double  asin(double);
  72. double  asinh(double);
  73. double  atan(double);
  74. double  atan2(double, double);
  75. double  atanh(double);
  76. double  cbrt(double);
  77. double  ceil(double);
  78. double  copysign(double,double);
  79. double  cos(double);
  80. double  cosh(double);
  81. double  drem(double,double);
  82. double  erf(double);
  83. double  erfc(double);
  84. double  exp(double);
  85. double  expm1(double);
  86. double  fabs(double);
  87. int finite(double);
  88. double  floor(double);
  89. double    fmod(double, double);
  90. double  frexp(double, int*);
  91. double  gamma(double);
  92. double  hypot(double,double);
  93. double  infnan(int);
  94. #if !defined(sequent) && !defined(DGUX) &&!defined(sony) && !defined(masscomp) && !defined(hpux)
  95. /* see below */
  96. int     isinf(double);
  97. int     isnan(double);
  98. #endif
  99. double  j0(double);
  100. double  j1(double);
  101. double  jn(int, double);
  102. double  ldexp(double, int);
  103. double  lgamma(double);
  104. double  log(double);
  105. double  log10(double);
  106. double  log1p(double);
  107. double  logb(double);
  108. double  modf(double, double*);
  109. double  pow(double, double);
  110. double  rint(double);
  111. double  scalb _G_ARGS((double, int));
  112. double  sin(double);
  113. double  sinh(double);
  114. double  sqrt(double);
  115. double  tan(double);
  116. double  tanh(double);
  117. double  y0(double);
  118. double  y1(double);
  119. double  yn(int, double);
  120.  
  121. double aint(double);
  122. double anint(double);
  123. int irint(double);
  124. int nint(double);
  125. }
  126.  
  127. #endif
  128.  
  129. /* libg++ doesn't use this since it is not available on some systems */
  130.  
  131. /* the following ifdef is just for compiling OOPS */
  132.  
  133. #ifndef DONT_DECLARE_EXCEPTION
  134. struct libm_exception
  135. {
  136.   int type;
  137.   char* name;
  138.   double arg1, arg2, retval;
  139. };
  140.  
  141. #define DOMAIN      1
  142. #define SING        2
  143. #define OVERFLOW    3
  144. #define UNDERFLOW   4
  145. #define TLOSS       5
  146. #define PLOSS       6
  147.  
  148. extern "C" int matherr(libm_exception*);
  149.  
  150. #endif
  151.  
  152. #include <float.h>
  153.  
  154. /* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */
  155.  
  156. #ifndef HUGE
  157. #define HUGE    DBL_MAX
  158. #endif
  159. #ifndef HUGE_VAL
  160. #define HUGE_VAL    DBL_MAX
  161. #endif
  162.  
  163.  
  164. /* sequents don't supply these. The following should suffice */
  165. #if defined(sequent) || defined(DGUX) || defined(sony) || defined(masscomp) \
  166. || defined(hpux)
  167. #include <float.h>
  168. static inline int isnan(double x) { return x != x; }
  169. static inline int isinf(double x) { return x > DBL_MAX || x < -DBL_MAX; }
  170. #endif
  171.  
  172. /* These seem to be sun & sysV names of these constants */
  173.  
  174. #ifndef M_E
  175. #define M_E         2.7182818284590452354
  176. #endif
  177. #ifndef M_LOG2E
  178. #define M_LOG2E     1.4426950408889634074
  179. #endif
  180. #ifndef M_LOG10E
  181. #define M_LOG10E    0.43429448190325182765
  182. #endif
  183. #ifndef M_LN2
  184. #define M_LN2       0.69314718055994530942
  185. #endif
  186. #ifndef M_LN10
  187. #define M_LN10      2.30258509299404568402
  188. #endif
  189. #ifndef M_PI
  190. #define M_PI        3.14159265358979323846
  191. #endif
  192. #ifndef M_PI_2
  193. #define M_PI_2      1.57079632679489661923
  194. #endif
  195. #ifndef M_1_PI
  196. #define M_1_PI      0.31830988618379067154
  197. #endif
  198. #ifndef M_PI_4
  199. #define M_PI_4      0.78539816339744830962
  200. #endif
  201. #ifndef M_2_PI
  202. #define M_2_PI      0.63661977236758134308
  203. #endif
  204. #ifndef M_2_SQRTPI
  205. #define M_2_SQRTPI  1.12837916709551257390
  206. #endif
  207. #ifndef M_SQRT2
  208. #define M_SQRT2     1.41421356237309504880
  209. #endif
  210. #ifndef M_SQRT1_2
  211. #define M_SQRT1_2   0.70710678118654752440
  212. #endif
  213.  
  214. #ifndef PI                      // as in stroustrup
  215. #define PI  M_PI
  216. #endif
  217. #ifndef PI2
  218. #define PI2  M_PI_2
  219. #endif
  220.  
  221. #endif
  222.